<template>
	<view class="history">
		<image src="../../static/images/history.png"></image>
		<view>浏览历史</view>
	</view>
	<view class="newBox">
		<view v-if="historyList.length>0" v-for="item in historyList" :key="item.id" class="news" @click="toNewsDetail(item)">
		<newsListItem :listitem="item"></newsListItem>
			<!-- <view class="pic">
				<image mode="aspectFill" :src="item.picurl"></image>
			</view>
			<view class="content">
				<view class="title">{{item.title}}</view>
				<view class="info">
					<view class="publish">浏览时间：{{parseTime(item.date,'{y}-{m}-{d} {h}:{i}')}}</view>
				</view>
			</view> -->
		</view>
		<image mode="aspectFill" class="noDate" v-else src="../../static/images/nodata.png"></image>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onShow
	} from '@dcloudio/uni-app'
	const historyList=ref([])
	const toNewsDetail = (item) => {
		uni.navigateTo({
			url: `/pages/detail/detail?id=${item.id}&cid=${item.cid}`
		})
	}
	onShow(()=>{
		historyList.value=uni.getStorageSync('history')
	})
</script>

<style lang="scss" scoped>
	.history {
		padding: 50rpx;
		text-align: center;
		background-color: #F8F8F8;

		image {
			width: 150rpx;
			height: 150rpx;
		}

		view {
			font-size: 40rpx;
			color: #767980;
			margin-top: 20rpx;
		}
	}
	.newBox {
		padding-top: 30rpx;
	
		.noDate {
			width: 750rpx;
	
		}

	}
	
</style>